package com.treepoke.util.zip;

import com.treepoke.util.zip.zipframework.FileEntry;
import com.treepoke.util.zip.zipframework.Method;
import com.treepoke.util.zip.zipframework.ZIPFile;
import java.io.File;
import java.io.IOException;

public class ZipUtil {
    
    public static void zipFiles(File[] files, String zipped) 
    throws IOException {
        ZIPFile zip = new ZIPFile(zipped);

        Method oMethod = new Method();
        oMethod.setMethodValue(Method.Deflated);
           
        for(File file : files){
            zip.AddFile(new FileEntry(file.getAbsolutePath(), oMethod));
        }

        zip.CreateZIP();
    }    

    public static void zipFiles(File[] files, String password, String zipped) 
    throws IOException {
        ZIPFile zip = new ZIPFile(zipped);

        Method oMethod = new Method();
        oMethod.setMethodValue(Method.Deflated);
           
        for(File file : files){
            zip.AddFile(new FileEntry(file.getAbsolutePath(), password, oMethod));
        }

        zip.CreateZIP();
    }


}
